
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>行程</title>
    <link rel="stylesheet" href="../../css/aui.css" />
    <link rel="stylesheet" href="../../css/iconfont/iconfont.css" />
    <link rel="stylesheet" href="../../script/widget/Zepto/dropload.css">
    <link rel="stylesheet" href="../../css/trip/index.css">
    <link rel="stylesheet" href="../../css/my/index.css">
</head>
<body style="cursor: pointer;">
  <!-- 订单列表 -->
  <section class="aui-content" id="train_list_content">

  </section>

  <!--暂无数据时显示-->
  <div class="no-data">
      <i class="iconfont icon-wushuju"></i>
      <div style="text-align:center;color:#49B3D7;margin-top:-3rem;">目前暂无行程</div>
  </div>
  </body>
</html>
<script type="text/javascript" src="../../script/extend/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../script/aui/api.js"></script>
<script type="text/javascript" src="../../script/extend/doT.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/aui/aui-toast.js"></script>
<script type="text/javascript" src="../../script/aui/aui-tab.js"></script>
<!--列表模板 start-->
<script id="interpolationtmpl" type="text/x-dot-template">
    {{ for(var prop in it) { }}
    {{ if(it[prop]['product_id'] == 1){ }}
    <div class="aui-card-list" onclick="order_details('{{=it[prop].user_orderid}}')" >
        <div class="aui-card-list-header">
            <div class="col_center">
                <div class="train_time field_info">{{= it[prop]['take_off_time'] }}</div>
                <div class="train_site field_info">{{= it[prop]['take_off_place'] }}</div>
            </div>
            <div class="train_icon"><i class="icon iconfont icon-feiji" style="color: white;"></i></div>
            <div class="col_center">
                <div class="train_time">{{= it[prop]['to_ground_time']}}</div>
                <div class="train_site">{{= it[prop]['to_ground_place'] }}</div>
            </div>
        </div>
        <div class="aui-card-list-content-padded aui-border-t">
            <div class="row_space">
                <div class="col_left aui-col-xs-4">
                    <div class="train_field">日期</div>
                    <div class="field_info">{{= it[prop]['take_off_date'] }}</div>
                    <div class="train_field">状态</div>
                    <div class="field_info">{{= it[prop]['status_text'] }}</div>
                </div>
                <div class="col_center aui-col-xs-4">
                    <div class="train_field">航班</div>
                    <div class="field_info">{{= it[prop]['flight_number'] }}</div>
                    <div class="train_field">总额</div>
                    <div class="train_price">￥{{= it[prop]['order_total_price'] }}</div>
                </div>
                <div class="col_right aui-col-xs-4">
                    <div class="train_field">舱位</div>
                    <div class="field_info">{{= it[prop]['shipping_space'] }}</div>
                </div>
            </div>
        </div>
    </div>
    {{ }else if(it[prop]['product_id'] == 5){ }}
    <div class="aui-card-list" onclick="order_details('{{=it[prop].user_orderid}}')" >
        <div class="aui-card-list-header">
            <div class="col_center">
                <div class="train_time field_info">{{= it[prop]['train_start_time'] }}</div>
                <div class="train_site field_info">{{= it[prop]['from_station_name'] }}</div>
            </div>
            <div class="train_icon"><i class="icon iconfont icon-huochepiao1"></i></div>
            <div class="col_center">
                <div class="train_time">{{= it[prop]['train_end_time']}}</div>
                <div class="train_site">{{= it[prop]['to_station_name'] }}</div>
            </div>
        </div>
        <div class="aui-card-list-content-padded aui-border-t">
            <div class="row_space">
                <div class="col_left aui-col-xs-4">
                    <div class="train_field">日期</div>
                    <div class="field_info">{{= it[prop]['train_date'] }}</div>
                    <div class="train_field">状态</div>
                    <div class="field_info">{{= it[prop]['status_text'] }}</div>
                </div>
                <div class="col_center aui-col-xs-4">
                    <div class="train_field">车次</div>
                    <div class="field_info">{{= it[prop]['train_code'] }}</div>
                    <div class="train_field">总额</div>
                    <div class="train_price">￥{{= it[prop]['order_total_price'] }}</div>
                </div>
                <div class="col_right aui-col-xs-4">
                    <div class="train_field">座位</div>
                    <div class="field_info">{{= it[prop]['train_seat_type'] }}</div>
                </div>
            </div>
        </div>
    </div>
    {{ }else{ }}
    <div class="aui-card-list" onclick="order_details('{{=it[prop].user_orderid}}')" >
        <div class="">
            <div class="hotel_title">
                <div class="train_icon" style="float: left;"><i class="icon iconfont icon-building" style="color: white;"></i></div>
                <div class="hotel_date">
                    <span>{{=it[prop].arrival_time}} - {{=it[prop].departure_time}}</span>
                </div>
            </div>
            <div class="hotel_name">
                <span>{{=it[prop].hotel_name}}</span>
            </div>
        </div>
        <div class="aui-card-list-content-padded aui-border-t">
            <div class="row_space">
                <div class="col_left aui-col-xs-4">
                    <div class="train_field">房型</div>
                    <div class="field_info">{{= it[prop]['room_type_name'] }}</div>
                </div>
                <div class="col_center aui-col-xs-4">
                    <div class="train_field">状态</div>
                    <div class="field_info">{{= it[prop]['status_text'] }}</div>
                </div>
                <div class="col_right aui-col-xs-4">
                    <div class="train_field">总额</div>
                    <div class="train_price">￥{{= it[prop]['order_total_price'] }}</div>
                </div>
            </div>
        </div>
    </div>
    {{ } }}
    {{ } }}
</script>
<script>
    //当前页数
    var pageIndex = 0,
        maxPage,  //最大页数
        container = $("#train_list_content");
    apiready = function(){
        api.parseTapmode();

        getItem(true);
        //下拉刷新
        push_down(function() {
            getItem(true);
        });
        //上拉加载
        push_up(function() {
            getItem(false);
        });
    }

    //详情
    function order_details(user_orderid){
        api.openWin({
            name: 'order_details_win',
            url: '../my/order/order_details_win.html',
            pageParam: {
                user_orderid: user_orderid
            }
        });
    }

    function getItem (isFresh) {
        //加载
        if (isFresh) {
            container.empty();
            pageIndex = 1;
        } else {
            pageIndex++;
        }
        var param = {};
        //页数
        param.url = Config.common.getJourneyList;
        param.data = {limit:10,page:pageIndex};
        if (pageIndex > maxPage) {
            $toast('已滚动到底部');//提示信息
            return false;
        }
        ajax(param,function(ret){
            if(ret.code == 1 && ret.data.data.length > 0) {
                var dataInter = ret.data.data;
                var interText = doT.template($("#interpolationtmpl").text());
                container.append(interText(dataInter));
                maxPage = parseInt(ret.data.last_page);
            } else {
                $('.no-data').css('display','block');
                if(ret.data.data.length <= 0) {
                    if (ret.data.last_page != 1) {
                        var msg_content = '暂无数据';
                    }
                } else {
                    var msg_content = ret.msg;
                }
                if (msg_content != undefined) {
                }
            }
        });
        api.refreshHeaderLoadDone();
    }
</script>
